﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace V5_Common
{
    public class Pr
    {
        public static void RegClientScript(Page p,string scriptstrings)
        {
            p.ClientScript.RegisterStartupScript(p.GetType(),
                p.GetType().ToString() + "RegClientScript", 
                scriptstrings);
        }

        public static void RegClientAlertAndRedirect(
            Page p,
            string msgStrings,
            string url)
        {
            p.ClientScript.RegisterStartupScript(p.GetType(),
                p.GetType().ToString() + "RegClientAlertAndRedirect",
                string.Format("<script type='text/javascript'>alert('{0}');window.location.replace('{1}')</script>",
                msgStrings,
                url));
        }

        public static void RegClientAlert(
           Page p,
           string msgStrings)
        {
            p.ClientScript.RegisterStartupScript(p.GetType(),
                p.GetType().ToString() + "RegClientAlertAndRedirect",
                string.Format("<script type='text/javascript'>alert('{0}');</script>",
                msgStrings));
        }
    }
}
